from datetime import datetime, timezone

class Quote:
    def __init__(self, bid_p: float, bid_v: int, ask_p: float, ask_v: int,
                 bid_q: dict, ask_q: dict):
        self.bid_p = bid_p
        self.bid_v = bid_v
        self.ask_p = ask_p
        self.ask_v = ask_v
        self.bid_q = bid_q
        self.ask_q = ask_q

class StockSnapshot:
    def __init__(self, quotes: list[Quote], symbol: str, price: float, open_price: float,
                 high_price: float, low_price: float, cum_volume: int, cum_amount: float, cum_position: int,
                 last_amount: float, last_volume: int, trade_type: int, flag: int, receive_local_time: float, iopv: float):
        self.quotes = quotes
        self.symbol = symbol
        self.created_at = created_at
        self.price = price
        self.open = open_price
        self.high = high_price
        self.low = low_price
        self.cum_volume = cum_volume
        self.cum_amount = cum_amount
        self.cum_position = cum_position
        self.last_amount = last_amount
        self.last_volume = last_volume
        self.trade_type = trade_type
        self.flag = flag
        self.receive_local_time = receive_local_time
        self.iopv = iopv

# Convert the provided data into instances of Quote and StockSnapshot
data = {
    'quotes': [
        {
            'bid_p': 7.33,
            'bid_v': 188500,
            'ask_p': 7.34,
            'ask_v': 111800,
            'bid_q': {'total_orders': 0, 'queue_volumes': []},
            'ask_q': {'total_orders': 0, 'queue_volumes': []},
        }
    ],
    'symbol': 'SHSE.600000',
    'price': 7.34,
    'open': 7.34,
    'high': 7.46,
    'low': 7.31,
    'cum_volume': 45967751,
    'cum_amount': 339215987.0,
    'cum_position': 0,
    'last_amount': 52842.0,
    'last_volume': 7200,
    'trade_type': 7,
    'flag': 0,
    'receive_local_time': 1713423383.8823838,
    'iopv': 0.0
}

quotes = [Quote(**quote_data) for quote_data in data['quotes']]
stock_snapshot = StockSnapshot(quotes, **data)

# Now you can access the properties of the stock snapshot object, e.g.:
print(stock_snapshot.symbol)
print(stock_snapshot.price)
